<?xml version="1.0" encoding="utf-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE >
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>销售机会</title>
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
		<script src="https://unpkg.com/vue/dist/vue.js"></script>
		<!-- 引入组件库 -->
		<script src="https://unpkg.com/element-ui/lib/index.js"></script>
		<!-- 引入axios -->
		<script src="../js/axios.js"></script>
		<script src="../js/qs.js"></script>
		<!-- 导入jquery -->
		<script src="../js/jquery.min.js"></script>
		<style type="text/css">
.loading{
        width: 100%;
        height: 100%;
        position: fixed;
        background-color: white;
        top: 0px;
        left: 0px;
        z-index: 100;
}	
.loading .bigpic{
    width: 104px;
    height: 104px;
    background-image: url("../imgs/loading.gif") ;
    position: absolute;
    top: 0px;
    bottom: 0px;
    right: 0px;
    left: 0px;
    margin: auto;
}
.select{
width:130px;
}
 .bg-purple {
 
  }
  .grid-content {
    border-radius: 4px;
  }
.undo{
    background-image: url("") ;
}
		</style>
<script>


	
</script>

		<!--<style type="text/css">
			//这段代码是让分割线中间加文字
.order {
   height: 60px;
   line-height: 60px;
   text-align: center;
}
 .order .line {
   display: inline-block;
   width: 150px;
   border-top: 1px solid #ccc ;
}
.order .txt {
   color: #686868;
   vertical-align: middle;
}
		</style>-->
	</head>
	<body>
		<!-- 搜索 -->
<!-- 		<div class="loading">
			<div class="bigpic"><div class="bigpic"></div></div>
		</div> -->
		<div id="bigbox" >
			 <div style="width: 100%;margin-left: 15px;display: block;" > 
				<i class="el-icon-caret-right" style="line-height: 40px;margin-right: 5px; float: left;"></i>
				<template style="margin-top: 50px;">
  			<el-select v-model="value7" placeholder="请选择" multiple style="float: left;width:200px;" @change="handleSelect" @visible-change="visibleChange()" @remove-tag="removeTag()"   >
  			<!-- :key="group.label",:key="item.value" -->
    		<el-option-group v-for="group in options3" :key="group.label"  :label="group.label" >
      		<el-option v-for="item in group.options"  :key="item.value" :label="item.label" :value="item.value">
     		 </el-option>
    		</el-option-group>
 			 </el-select>
				</template>
				<i class="el-icon-search" style="line-height: 40px;float: left;margin-left: 10px; width: 50px; height: 50px;"></i>
				<!-- 搜索框 -->
				<div style="display: block;margin-left: -20px;float: left;">
				<!-- state1Flag=false	 -->
			    <el-autocomplete class="inline-input" v-model="state1" :fetch-suggestions="querySearchAsync" placeholder="请输入内容" @select="handleSelect" @focus="stateManagement(true,1)" @blur="state1Flag=false">
			    	<el-select v-model="select" slot="append" placeholder="请选择" class="select" @change="clearData()">
			      	<el-option label="机会主题" value="1"></el-option>
			      	<el-option label="客户名称" value="2"></el-option>
			      	<el-option label="联系人" value="3"></el-option>
			    	</el-select>
			    </el-autocomplete>
				</div>
				<!-- 表单 -->
			<div style="width: 99%;float: left;" id="app2">
				<!-- <div style="float: left;margin-left: 30px;margin-top: -10px;"></div> -->
<el-row :gutter="20">
  <el-col :span="20">
  <div class="grid-content bg-purple" style="padding: 10px 0;">
  <span style="font-size: 13px;color: #333333;">机会列表</span> 
	<!--   <div style="width:50px;height:40px;"></div>-->
    <el-tooltip  effect="dark" content="解除搜索，显示全部数据" placement="right" v-show="removeSearch">
      <el-button style="padding:2px 5px; border-radius: 8px;background-color:red;color:white;"v-on:click="removeSearch1()"><img src="../imgs/undo.png" style="width:13px;height:13px;"/><span style="font-size:10px;">解除搜索</span></el-button>
    </el-tooltip>		
  </div>
  </el-col>
  <el-col :span="4"><div class="grid-content bg-purple" style="padding-top:0px;margin-left:40px">
   <el-button size="small" icon="el-icon-circle-plus" v-on:click="loadInfo(0)" @click="dialogFormVisible = true" style="width: 80px;"> 新建</el-button> 
   <el-button type="text" icon="el-icon-setting" @click="showInfo = true"></el-button>
<el-dialog
  title="销售机会数据显示设置"
  :visible.sync="showInfo"
  width="36%"
  :before-close="handleClose">

 <!-- 
 								showSoltId:true,//这里设置字段是否显示
								showSalType:true,//类型
								showSotlDate:true;//预计签单日期
								showStarStandard:true;//星标
								showSotlMoney:true;//预期金额
								showSal_updatetime:true;//销售机会的更新时间
								showCon_id:true,//联系人名称
								showSal_state:true,// 销售状态
								showCst_demand :true,//客户需求
								showSal_possibility:true,//可能性
								showSal_source:true,//来源
								showSotl_name:true,//机会负责人名
								showSal_stage:true,//销售阶段
								showSal_stage_notes:true,//阶段备注
								showSal_stage_stop:true,//阶段停留
								showSal_file:true,//上传附件	
  -->
   <el-checkbox v-model="showSoltId">负责人</el-checkbox>
   <el-checkbox v-model="showSalType">类型</el-checkbox>
      <el-checkbox v-model="showSotlDate">预计签单日期</el-checkbox>
         <el-checkbox v-model="showStarStandard">星标</el-checkbox>
            <el-checkbox v-model="showSotlMoney">预期金额</el-checkbox>
               <el-checkbox v-model="showSalupdatetime">更新时间</el-checkbox>
                  <el-checkbox v-model="showConid">联系人</el-checkbox>
                     <el-checkbox v-model="showSalstate">销售状态</el-checkbox>
                        <el-checkbox v-model="showCstdemand">客户需求</el-checkbox>
                           <el-checkbox v-model="showSalpossibility">可能性</el-checkbox>
                              <el-checkbox v-model="showSalstage">销售阶段</el-checkbox>
                                 <el-checkbox v-model="showSalstagenotes">阶段备注</el-checkbox>
                                    <el-checkbox v-model="showSalstagestop">阶段停留</el-checkbox>
                                      <el-checkbox v-model="showSalfile">上传附件</el-checkbox>
                                      <el-checkbox v-model="showSalsource">来源</el-checkbox>
  <span slot="footer" class="dialog-footer">
    <el-button @click="showInfo = false">取 消</el-button>
    <el-button type="primary" @click="saveshowInfo()">保存</el-button>
  </span>
</el-dialog>
  </div>
  </el-col>
</el-row>
				  <div style="float: right;display: block;margin-right: 20px;margin-top: -10px;" @click="deathWindow('form')" >

					<!-- 这里是弹窗--start-->					
					<el-dialog   title="新建销售机会" :visible.sync="dialogFormVisible" width="70%"  >
						<hr style="border: 1px solid #000000;margin-top: -15px;" />
						<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">机会</p>
						<hr style="border: 0.5px solid #EEEEEE;" />
						<el-form :model="form" :rules="rules" label-width="150px" ref="form"  style="height: 1130px; margin-top: 20px;">
							<el-row >
								<el-col :span="12">
									<el-form-item label="机会主题:" prop="salTheme">
										<el-input v-model="form.salTheme"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="更新时间:">
										<el-date-picker v-model="form.salUpdatetime" align="right" type="date" placeholder=" " :picker-options="pickerOptions1" :disabled="true">
										</el-date-picker>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row >
								<el-col :span="12">
										<el-form-item label="状  态:">
   											 <el-radio v-model="form.salState" label="1287">跟踪</el-radio>
  											 <el-radio v-model="form.salState" label="1288">成功</el-radio>
  											 <el-radio v-model="form.salState" label="1289">失败</el-radio>
  											 <el-radio v-model="form.salState" label="1290">搁置</el-radio> 	
   											 <el-radio v-model="form.salState" label="1291">失效</el-radio>  											 

											</el-form-item>
								</el-col>
								<el-col :span="12">
						<el-form-item label="对应客户:" prop="customer">
						<!-- :fetch-suggestions="querySearchAsync"customerFlag:false,soltIdFlag:false-->
						<el-autocomplete v-model.trim="form.customer" :fetch-suggestions="querySearchAsync"  placeholder="请输入内容" @select="handleSelect" @focus="customerFlag=true" @blur="customerFlag=false">
						 <i slot="prefix" class="el-input__icon el-icon-search"></i>
						</el-autocomplete>
					    	</el-form-item>
								</el-col>
							</el-row>
							<hr style="border: 0.5px solid #EEEEEE;margin-top: 15px;" />
							<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">基本信息</p>
							<hr style="border: 0.5px solid #EEEEEE;" />
							<!--<hr style="border: 0.5px solid #333333;margin: 35px 0px 35px 0px;" />-->
							
							<el-row style="margin-left: 10px;">
								<el-col :span="12">
								<el-form-item label="联系人:">
										<el-select v-model="form.contact" filterable placeholder="未选" required>
											<el-option v-for="item in contacts" :key="item.con" :label="item.conlabel" :value="item.con">
											</el-option>
											</el-select>

									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="类型:">
										<el-select v-model="form.salType" filterable placeholder="未选" required>
											<el-option v-for="item in salTypes" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row style="margin-left: 10px;">
								<el-col :span="12">
									<el-form-item label="来源:">
										<el-select v-model="form.salSource" filterable placeholder="未选" required>
											<el-option v-for="item in salSources" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="负责人:">
										<!-- <el-select v-model="form.sotlId" filterable placeholder="索引">
											<el-option v-for="item in users" :key="item.value" :label="item.label" :value="item.value">
											</el-option>											
												</el-select> -->
						<el-autocomplete v-model.trim="form.sotlId" :fetch-suggestions="querySearchAsync"  placeholder="请输入内容" @select="handleSelect" @focus="soltIdFlag=true" @blur="soltIdFlag=false">
								 <i slot="prefix" class="el-input__icon el-icon-search"></i>
						</el-autocomplete>												
									</el-form-item>
								</el-col>								
							</el-row>
<!-- 							<el-row style="margin-left: 10px;">
								<el-col :span="12">
									<el-form-item label="负责人:">
										<el-select v-model="form.sotlId" filterable placeholder="索引">
											<el-option v-for="item in users" :key="item.value" :label="item.label" :value="item.value">
											</el-option>											
												</el-select>
						<el-autocomplete v-model.trim="form.sotlId" :fetch-suggestions="querySearchAsync"  placeholder="请输入内容" @select="handleSelect" @focus="soltIdFlag=true" @blur="soltIdFlag=false">
								 <i slot="prefix" class="el-input__icon el-icon-search"></i>
						</el-autocomplete>												
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="提供人:">
										<el-select v-model="form.provider" filterable placeholder="未选">
											<el-option v-for="item in providers" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
							</el-row> -->
					<el-row style="margin-left: 10px;">
						<el-form-item label="客户需求:">
						<el-input type="textarea"  style="width:82%" :rows="5"  v-model="form.custDemand"> </el-input>
						</el-form-item>
						</el-row>
							<hr style="border: 0.5px solid #EEEEEE;margin-top: 15px;" />
							<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">预期</p>
							<hr style="border: 0.5px solid #EEEEEE;" />	
							<el-row style="margin-left: 10px;">
								<el-col :span="12">
									<el-form-item label="预计签单日期:" prop="sotlDate">
										<el-date-picker v-model="form.sotlDate" align="right" type="date" placeholder=" "  >
										</el-date-picker>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="可能性:" clearable="true">
										<el-select v-model="form.salPossibility" filterable placeholder="未选" >
											<el-option v-for="item in possibilities" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row style="margin-left: 10px;">	
								<el-col :span="12">
									<el-form-item label="预期金额:" prop="sotlMoney">
									<el-input v-model.number="form.sotlMoney" style="width:57%;"></el-input>
									</el-form-item>
								</el-col>
							</el-row>						
							<hr style="border: 0.5px solid #EEEEEE;margin-top: 15px;" />
							<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">当前状态</p>
							<hr style="border: 0.5px solid #EEEEEE;" />	
							<el-row style="margin-left: 10px;">
								<el-col :span="12">
									<el-form-item label="星 标:"> 
   											 <el-radio v-model="form.starStandard" label="1317"><label for="star">无</label></el-radio>
  											 <el-radio v-model="form.starStandard" label="1318"><label for="starRed"><img src="../imgs/sales/starBlue.png"></label></el-radio>
  											 <el-radio v-model="form.starStandard" label="1319"><label for="starYellow"><img src="../imgs/sales/starYellow.png"></label></el-radio>
  											 <el-radio v-model="form.starStandard" label="1320"><label for="starBlue"><img src="../imgs/sales/starBlue.png"></label></el-radio> 	
   											 <el-radio v-model="form.starStandard" label="1321"><label for="starGreen"><img src="../imgs/sales/starGreen.png"></label></el-radio> 
											 <el-radio v-model="form.starStandard" label="1322"><label for="starPurple"><img src="../imgs/sales/starPurple.png"></label></el-radio> 	
									
									</el-form-item>
								</el-col>
								<el-col :span="12">
								<el-form-item label="阶段:" prop="salStage">							
										<el-select v-model="form.salStage" filterable placeholder="索引">
											<el-option v-for="c in stages" :key="c.value" :label="c.label" :value="c.value">
											</el-option>
										</el-select>
									</el-form-item>
								</el-col>
							</el-row>
							
							<el-row style="margin-left: 10px;">	
								<el-col :span="24">
								<el-form-item label="阶段备注:">
									<el-input v-model="form.salStageNotes" style="width:82%"></el-input>
									</el-form-item>
								</el-col>
							</el-row>
							
	 						<el-row style="margin-left: 10px;">	
								<el-col :span="24">
								<el-form-item label="阶段停留:"style="width:82%" v-model="form.salStageStop">
								</el-form-item>
								</el-col>
							</el-row>
							
							<el-row style="margin-left: 10px;">	
								<el-col :span="24">
								<el-form-item label="跟踪日志:">
									<el-input v-model="form.salesOpportunityTrackingLogs" :disabled="true" style="width:82%"></el-input>
									</el-form-item>
								</el-col>
							</el-row>
						<hr style="border: 0.5px solid #EEEEEE;" />						
							<el-form-item style="float: right;margin-top: 40px;">
								<el-button @click="cancelForm('form')">取 消</el-button>
								<el-button type="primary" @click="submitForm('form')" >确定</el-button>
								<el-button @click="resetForm('form')">重置</el-button>
							</el-form-item> 
						</el-form>
					</el-dialog>
					<!--这里是弹窗--end-->
					
				</div>
				</div>
 

			</div>

			<!-- 表单 -->
			<div id="app3" >
			<!-- element-loading-spinner="el-icon-loading" element-loading-text="拼命加载中"-->
			
			<div id="print"  >
			<!-- printStart -->
					<el-table ref="multipleTable" tooltip-effect="dark" @selection-change="handleSelectionChange" :data="tableData3"
					 v-loading="tableloading"   :cell-style="cellStyle" :header-cell-style="cellStyle" 
						 border style="border:1px solid #ebeef5;width: 100%;"
					  element-loading-background="rgba(0, 0, 0, 0)"  >
						<el-table-column type="selection" width="35" v-if="printFlag1==false" >
						</el-table-column>				
						<el-table-column prop="salId" label="ID" >
						</el-table-column>
						<el-table-column prop="salTheme" label=" 机会主题">
						</el-table-column>
						<el-table-column prop="custName" label=" 客户">
						</el-table-column>
						<el-table-column prop="starStandard" label=" 星标" align="center" v-if="showStarStandard==1" >	
						<template scope="scope"> 
						<img :src="scope.row.starStandard"  v-if="scope.row.starStandard!='无'"/> 
						</template> 				
						</el-table-column>
						<el-table-column prop="salType" label="类型" v-if="showSalType==1">
						</el-table-column>
						<el-table-column prop="sotlId" label="负责人" v-if="showSoltId==1">
						</el-table-column>						
						<el-table-column prop="sotlDate" label="预计签单日期" v-if="showSotlDate==1">
						</el-table-column>
						<el-table-column prop="salSource" label="来源" v-if="showSalsource==1">
						</el-table-column>
						<el-table-column prop="sotlMoney" label="预期金额" v-if="showSotlMoney==1">
						</el-table-column>
						<el-table-column prop="custDemand" label="客户需求" v-if="showCstdemand==1">
						</el-table-column>
						<el-table-column prop="salStageStop" label="阶段停留" v-if="showSalstagestop==1">
						</el-table-column>
						<el-table-column prop="salState" label="销售状态" v-if="showSalstate==1">
						</el-table-column>
						<el-table-column prop="salStageNotes" label="阶段备注" v-if="showSalstagenotes==1">
						</el-table-column>
						<el-table-column prop="salUpdatetime" label="更新时间" v-if="showSalupdatetime==1">
						</el-table-column>
						<el-table-column prop="salPossibility" label="可能性"  v-if="showSalpossibility==1">
						</el-table-column>
						
						<el-table-column prop="salFile" label="上传附件 " v-if="showSalfile==1">
						</el-table-column>
						<el-table-column fixed="right" label="操作" width="120px" v-if="printFlag2==false" >
							<template slot-scope="scope">
							<el-tooltip content="Bottom center" placement="bottom" width="50px">
							 <div slot="content">订单视图</div>
								<i class="el-icon-document" style="margin: 0px 2px;font-size: 17px;" @click="saleView(scope.row.salId)"></i>
							</el-tooltip>
								<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">编辑</div>								
									<i class="el-icon-edit" v-on:click="loadInfo(scope.row.salId)" @click="dialogrepair = true" style="font-size: 17px;"></i>
								</el-tooltip>
									<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">删除</div>
									<i class="el-icon-delete" style="margin: 0px 10px;font-size: 17px;"  @click="DeleteShow(scope.row.salId)" ></i>
								</el-tooltip>							
							</template>
						</el-table-column>
						
					</el-table>
				</div>
					<el-dialog title="提示" :visible.sync="dialogDelete" width="30%" append-to-body>
					 	 <span>你确定要删除吗？</span>
					  	<span slot="footer" class="dialog-footer">
					    <el-button @click="dialogDelete = false">取 消</el-button>
					    <el-button type="primary" @click="dialogDelete = false" v-on:click="Delete" >确 定</el-button>
					  </span>
					</el-dialog>
							<!-- 修改销售机会 -->				
					<div style="float: right;display: block;margin-right: 20px;margin-top: -10px;">		
						<!-- 这里是弹窗--start    style="background-color: #E5E9F2;"-->		
					<el-dialog   title="修改销售机会" :visible.sync="dialogrepair" width="70%"  append-to-body >
						<hr style="border: 1px solid #000000;margin-top: -15px;" />
						<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">机会</p>
						<hr style="border: 0.5px solid #EEEEEE;" />
						<!--<div class="order">
   							<span class="line"></span>
   							<span class="txt">产品清单</span>
   							<span class="line"></span>
						</div>-->
						<el-form :model="form" :rules="rules" label-width="150px" ref="form" style="height: 1300px; margin-top: 20px;" >
							<el-row >
								<el-col :span="12">
									<el-form-item label="机会主题:" prop="salTheme">
										<el-input v-model="form.salTheme"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="更新时间:">
										<el-date-picker v-model="form.salUpdatetime" align="right" type="date" placeholder=" " :picker-options="pickerOptions1" :disabled="true">
										</el-date-picker>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row >
								<el-col :span="12">
										<el-form-item label="状  态:">
   											 <el-radio v-model="form.salState" label="1287">跟踪</el-radio>
  											 <el-radio v-model="form.salState" label="1288">成功</el-radio>
  											 <el-radio v-model="form.salState" label="1289">失败</el-radio>
  											 <el-radio v-model="form.salState" label="1290">搁置</el-radio> 	
   											 <el-radio v-model="form.salState" label="1291">失效</el-radio>  											 
											</el-form-item>
						<el-form-item label="对应客户:" prop="customer">
						<!-- :fetch-suggestions="querySearchAsync" -->
						<el-autocomplete v-model.trim="form.customer" :fetch-suggestions="querySearchAsync"  placeholder="请输入内容" @select="handleSelect"  :disabled="true">
						 <i slot="prefix" class="el-input__icon el-icon-search"></i>
						</el-autocomplete>
					    	</el-form-item>
								</el-col>
							</el-row>
							<hr style="border: 0.5px solid #EEEEEE;margin-top: 15px;" />
							<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">基本信息</p>
							<hr style="border: 0.5px solid #EEEEEE;" />
							<!--<hr style="border: 0.5px solid #333333;margin: 35px 0px 35px 0px;" />-->
							
							<el-row style="margin-left: 10px;">
								<el-col :span="12">
								<el-form-item label="联系人:">
										<el-select v-model="form.contact" filterable  placeholder="未选" :disabled="true">
											<el-option v-for="item in contacts" :key="item.con" :label="item.conlabel" :value="item.con">
											</el-option>
											</el-select>

									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="类型:">
										<el-select v-model="form.salType"  filterable placeholder="未选"  >
											<el-option v-for="item in salTypes" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row style="margin-left: 10px;">
								<el-col :span="12">
									<el-form-item label="来源:">
										<el-select v-model="form.salSource" filterable placeholder="未选" >
											<el-option v-for="item in salSources" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="负责人:">
						<el-autocomplete v-model.trim="form.sotlId" :fetch-suggestions="querySearchAsync"  placeholder="请输入内容" @select="handleSelect" >
								 <i slot="prefix" class="el-input__icon el-icon-search"></i>
						</el-autocomplete>
									</el-form-item>
								</el-col>								
							</el-row>
							<!-- <el-row style="margin-left: 10px;">
								<el-col :span="12">
									<el-form-item label="负责人:">
						<el-autocomplete v-model.trim="form.sotlId" :fetch-suggestions="querySearchAsync"  placeholder="请输入内容" @select="handleSelect" >
								 <i slot="prefix" class="el-input__icon el-icon-search"></i>
						</el-autocomplete>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="提供人:">
										<el-select v-model="form.provider" filterable placeholder="未选" >
											<el-option v-for="item in providers" :key="item.value" :label="item.label" :value="item.value" >
											</el-option>
												</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
							</el-row> -->
					<el-row style="margin-left: 10px;">
						<el-form-item label="客户需求:">
						<el-input type="textarea"  style="width:82%" :rows="5"  v-model="form.custDemand"> </el-input>
						</el-form-item>
						</el-row>
							<hr style="border: 0.5px solid #EEEEEE;margin-top: 15px;" />
							<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">预期</p>
							<hr style="border: 0.5px solid #EEEEEE;" />	
							<el-row style="margin-left: 10px;">
								<el-col :span="12">
									<el-form-item label="预计签单日期:" prop="sotlDate">
										<el-date-picker v-model="form.sotlDate" align="right" type="date" placeholder=" "  >
										</el-date-picker>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="可能性:" >
										<el-select v-model="form.salPossibility"  placeholder="未选">
											<el-option v-for="item in possibilities" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row style="margin-left: 10px;">	
								<el-col :span="12">
									<el-form-item label="预期金额:" prop="sotlMoney">
									<el-input v-model.number="form.sotlMoney" style="width:57%;"></el-input>
									</el-form-item>
								</el-col>
							</el-row>						
							<hr style="border: 0.5px solid #EEEEEE;margin-top: 15px;" />
							<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">当前状态</p>
							<hr style="border: 0.5px solid #EEEEEE;" />	
							<el-row style="margin-left: 10px;">
								<el-col :span="12">
									<el-form-item label="星 标:"> 
   											 <el-radio v-model="form.starStandard" label="1317"><label for="star">无</label></el-radio>
  											 <el-radio v-model="form.starStandard" label="1318"><label for="starRed"><img src="../imgs/sales/starBlue.png"></label></el-radio>
  											 <el-radio v-model="form.starStandard" label="1319"><label for="starYellow"><img src="../imgs/sales/starYellow.png"></label></el-radio>
  											 <el-radio v-model="form.starStandard" label="1320"><label for="starBlue"><img src="../imgs/sales/starBlue.png"></label></el-radio> 	
   											 <el-radio v-model="form.starStandard" label="1321"><label for="starGreen"><img src="../imgs/sales/starGreen.png"></label></el-radio> 
											 <el-radio v-model="form.starStandard" label="1322"><label for="starPurple"><img src="../imgs/sales/starPurple.png"></label></el-radio> 	
									
									</el-form-item>
								</el-col>
								<el-col :span="12">
								<el-form-item label="阶段:" prop="salStage" >
									
										<el-select v-model="form.salStage" filterable placeholder="索引" >
											<el-option v-for="c in stages" :key="c.value" :label="c.label" :value="c.value">
											</el-option>
										</el-select>
									</el-form-item>
								</el-col>
							</el-row>
							
							<el-row style="margin-left: 10px;">	
								<el-col :span="24">
								<el-form-item label="阶段备注:">
									<el-input v-model="form.salStageNotes" style="width:82%"></el-input>
									</el-form-item>
								</el-col>
							</el-row>
							
							<el-row style="margin-left: 10px;">	
								<el-col :span="24">
								<el-form-item label="阶段停留:"style="width:82%" v-model="form.salStageStop">
								<el-input v-model="form.salStageStop" style="width:82%" :disabled="true"></el-input>
								</el-form-item>
								</el-col>
							</el-row>
							
							<el-row style="margin-left: 10px;">	
								<el-col :span="24">
								<el-form-item label="跟踪日志:">
									<el-input v-model="salesOpportunityTrackingLogs" :disabled="true" style="width:82%" type="textarea"   :autosize="true"></el-input>
										
									</el-form-item>
								</el-col>
							</el-row>
						<hr style="border: 0.5px solid #EEEEEE;" />						
							<el-form-item style="float: right;margin-top: 40px;">
								<el-button @click="cancelForm('form')">取 消</el-button>
								<el-button type="primary" @click="submitForm('form')" v-on:click="dialogrepair= false">保存</el-button>
							</el-form-item>
						</el-form>
					</el-dialog>
					<!--这里是弹窗--end-->
					</div>
					<div style="margin-top: 10px">
						<div style="display: block; float: left;margin-left: 5px;">
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">删除</div>
								<i class="el-icon-delete" style="margin: 8px;font-size: 17px;"></i>
							</el-tooltip>
						</div>
						<!-- 分页 -->
						<div style="display: block; float: left; margin-left: 300px;">
							<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage4"
							 :page-sizes="page.pageCentent" :pager-count="5" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="page.AllpageNumber">
							</el-pagination>
						</div>
						
						<div style="display: block; float: right;margin-right: 15px;">
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">打印</div>
								<el-button circle size="mini"><i class="el-icon-printer" style="font-size: 17px;" @click="print(7)"></i></el-button>&nbsp;
							</el-tooltip>

							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">导出Excel</div>
								<el-button circle size="mini"><i class="el-icon-tickets" style="font-size: 17px;"></i></el-button>
							</el-tooltip>

						</div>
					</div>
				</template>
			</div>
		</div>
		<!-- src="../js/sales/saleOpp.js" -->
		<script type="text/jscript" >
					var Main1 = {
						data() {	
							//检查输入是否为数字,是否为空  
						      var checkSoltMoney = (rule, value, callback) => {
						          setTimeout(() => {
						        	 if(value==null||value==''){
						        		 callback();
						        	 }
						            if (!Number.isInteger(value)) {
						              callback(new Error('请输入数字值'));
						            } else {
						                callback();
						            }
						          }, 1000);
						        };
						    //检查机会主题是否重复，是否为空    
							   var checkSalTheme = (rule, value, callback) => {
								   if(value==null||value==''){
									   callback(new Error('机会主题为必填项'));  
								   }
								   var _this=this;
								 	axios.get("/sales/findBySalTheme",
						           			{
										params:{
											salTheme:value
												}
				           					}
						           			//ajax请求成功的回调函数
						          			).then(function(response){					          				
						           			console.log("回调成功，获取了服务器端返回的值v");
						           			console.log(response.data);//返回id值
						           			console.log(_this.form.salId);
						           			if(response.data){
						           				if(_this.form.salId==response.data){
						           					callback();						           					
						           				}else{
										           	 callback(new Error('该机会主题已存在，请重新命名'));							           					
						           				}
					           				
						           			}else{
						           				callback();
						           			}
						           	}).catch(function(){
						           	 callback(new Error('查询有误'));
						           	});
								 	
							       };
							 //检查签单预计时间是否大于等于今天      
						      var  checkSotlDate=(rule, value, callback) => {
						    	  //Thu Jul 12 2018 00:00:00 GMT+0800 (中国标准时间)
						    	  	//将当前日期转换成yyyy-MM-dd格式
						    	  	//var selectDate = value.format('yyyy-MM-dd');
									//alert(this.form.salTheme);
						    	 	 //将当前时间转换成yyyy-MM-dd
						    	 	 if(value==null||value==''){
						    	 		 callback();
						    	 	 }else{
						    	 		/* if(this.form.salId!=null){
						    	 			 
						    	 		 }*/
											var t2 =0;
						    	 		 try{
						    	 			 t2=new Date(value.replace("-", "/").replace("-", "/"));
						    	 			callback();
						    	 		 }catch(err)
						    	 		 {
									    	   var mydate = new Date();
												var str1 = "" + mydate.getFullYear() + "-";
												str1 += (mydate.getMonth()+1) + "-";
												str1 += mydate.getDate();
									    	 	 //将获取的时间转换成yyyy-MM-dd								    	 	 
													var str2 = "" + value.getFullYear() + "-";
													str2 += (value.getMonth()+1) + "-";
													str2 += value.getDate();
										    	//可将yyyy-MM-dd格式转成可以进行比较的yyyy/MM/dd格式										
												var tady=new Date(str1.replace("-", "/").replace("-", "/"));
							    	 			 t2=new Date(str2.replace("-", "/").replace("-", "/"));
									          setTimeout(() => {
									            if (t2<tady) {
									              callback(new Error('签单时间不能小于今天'));
									            } else {
									                callback();
									            }
									          }, 1000);												
									       };

						    	 	 }
							       };
							     //检查输入的客户数据是否存在,是否为空  
								 var checkCustomer = (rule, value, callback) => {
									   if(value==null||value==''){
										   callback(new Error('对应客户为必填项'));  
									   }
								          setTimeout(() => {
								            if (this.restaurants==null||this.restaurants=='') {
								              callback(new Error('您输入的客户名称不存在，请确认后再输入'));
								            } else {
								                callback();
								            }
								          }, 1000);
								   };
									       
							return {	
								
								tableData3:${salesOpp},//表格数据
								currentPage1: 5,//分页数据
								currentPage2: 5,//分页数据
								currentPage3: 5,//分页数据
								currentPage4: 4,//分页数据
								multipleSelection: [],
								dialogrepair: false,
								dialogDelete:false,
								tableloading:false,
								removeSearch:false,
								showInfo:false,//这个值是设置显示什么字段的判断值

								/* 
									salType   	类型
									starStandard   	星标
									sotlDate  	预计签单日期
									sotlMoney  	预期金额
									
									
									
									sal_updatetime  销售机会的更新时间
									con_id  	 联系人名称
									sal_state 	 销售状态
									cust_demand  	客户需求
									sotl_date   	预计签单日期
									sal_possibility 可能性
									sal_source   	来源
									sotl_name	机会负责人名
									sal_stage	销售阶段
									sal_stage_notes	阶段备注
									sal_stage_stop	阶段停留
									sal_file	上传附件

								*/	
								setId:-1,
								showSoltId:0,//这里设置字段是否显示
								showSalType:0,//类型
								showSotlDate:0,//预计签单日期
								showStarStandard:0,//星标
								showSotlMoney:0,//预期金额
								showSalupdatetime:0,//销售机会的更新时间
								showConid:0,//联系人名称
								showSalstate:0,// 销售状态
								showCstdemand :0,//客户需求
								showSalpossibility:0,//可能性
								showSalsource:0,//来源
								showSotlname:0,//机会负责人名
								showSalstage:0,//销售阶段
								showSalstagenotes:0,//阶段备注
								showSalstagestop:0,//阶段停留
								showSalfile:0,//上传附件								
						        options3: [
						        	{
							            label: '全部数据',
							            options: [{
							            	label:'全部数据',
							            	value:''
							            	}]						        		
						        	},{
						            label: '来源',
						            options: []
						          }, {
						            label: '可能性',
						            options: []
						          },
						          {
							           label: '销售阶段',
							           options: []						        	  
						          }],
						          value7:'',
						          value7Copy:'',
						          printFlag1:false,//这个值是为了在打印的时候去掉一些不必要的元素
						          printFlag2:false,//这个值是为了在打印的时候去掉一些不必要的元素
						          value7Flag:false,
						          option:'',
						          obj2:null,
						          state1:'',
						          state1Copy:'',
						          salStageCopy:'',//这个是销售机会负责人的copy
						          matchFlag:false,
						          state1Flag:false,
						          state1Session:false,
						          select:'1',
						          selectCopy:'1',
								customers:[{
									cus: '小米',
									cuslabel: '小米'
								},{
									cus: '小天',
									cuslabel: '小天'					
								}],
								form: {
										custDemand:'',
										salPossibility:'',
										salSource:'',
										salStage:'',
										salStageNotes:'',
										salStageStop:'',
										salState:'1287',
										salTheme:'',
										salType:'',
										salUpdatetime:new Date(),
										sotlDate:new Date(),
										sotlMoney:'',
										starStandard:'1317',
										customer:'',
										salId:'',
										contact:'',
										state:1,
										sotlId:''
									},
								salesOpportunityTrackingLogs:'',//这个值是为了显示销售机会跟踪日志
								page:{
									pageCentent:[4, 6, 10],	
									AllpageNumber:${salesCount}
								},
								pageNumber:1,								
								pageCententSelect:4,								
								salId:'',
								contacts:"",
								salTypes:"",
								salSources:' ',
								providers:' ',
								users:' ',
								possibilities:' ',
								stages:' ',
								gdID: '',
								conID:'',
								value8: '',
								valuecust: '',
								DId:0,
								data:[],
								flag:false,
								dialogFormVisible: false,
								customerFlag:false,
								soltIdFlag:false,
								rules:{
									customer:[
									{	
										required: true,validator:checkCustomer, trigger: 'change'
									}],
									salStage:[
									{	
										required: true,
										message: '请至少选择一个阶段',
										trigger: 'change'
									}	
									],
									sotlMoney:[
										{
											validator:checkSoltMoney, trigger: 'blur' 
										}
									],
									sotlDate:[{
										validator:checkSotlDate, trigger: 'change'
									}],
									salTheme:[{
										required: true,validator:checkSalTheme, trigger: 'blur'										
									}]									
								},
								/* 日期选择 */
								pickerOptions1: {
									disabledDate(time) {
										return time.getTime() > Date.now();
									},
									shortcuts: [{
										text: '今天',
										onClick(picker) {
											picker.$emit('pick', new Date());
										}
									}, {
										text: '昨天',
										onClick(picker) {
											const date = new Date();
											date.setTime(date.getTime() - 3600 * 1000 * 24);
											picker.$emit('pick', date);
										}
									}, {
										text: '一周前',
										onClick(picker) {
											const date = new Date();
											date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
											picker.$emit('pick', date);
										}
									}]
								},
								gettoday: new Date(),
								getDate:'',
								gettime: new Date(),
								prostarttoday:'',
								prosalettoday:'',
						        restaurants: [],
						        timeout:  null
							}
						},
					methods: {
						//相当于一种会话，要一次会话结束之后才会变为初始值，废弃
						stateManagement(item,index){
							if(index==1){
								this.state1Flag=item;
								if(this.state1Flag){
									this.state1Session=true;
								}
							}

						},
						//1.当选择其他字段时，清除数据筛选条件中的之前字段的搜索条件
						//2.当字段数据为空时，清除搜索条件
						//3.当字段数据为非比配数据值时，清除搜索条件
						
						//1.是否切换了字段搜索，就将之前的搜索条件删除（不管是否存在），删除时判断是否有不分组条件，存在就设置删除3个元素，否则则为2个元素
						//2.当搜索框搜索条件不存在或者为空时，清除搜索条件，如果存在则保留
						clearData(){	
							console.log("触发方法clearData清除搜索条件判断");	
							console.log("olddata:"+this.data);
							console.log("select:"+this.select);
							console.log("输入框当前值:"+this.state1);	
							var del=null;
							var i=0;
							if(this.selectCopy=='1'){
								del='机会主题';
							}else if(this.selectCopy=='2'){
								del='客户名称';
							}else{
								del='联系人';
							}
							if(this.selectCopy!=this.select){						
								console.log("del:"+del);
								this.data.find((a)=>{									
									if(a==del){
										console.log("a:"+a);
										if(this.data[i+1]=='不分组'){
											this.data.splice(i,3);											
										}else{
											this.data.splice(i,2);											
										}										
									}
									i++;
								});	
							this.selectCopy=this.select;
							}else{
								var flag=this.isMatch();
								console.log("搜索框的值是否匹配:"+flag);								
								if(!flag){
									this.data.find((a)=>{									
										if(a==del){
											console.log("进入:"+flag);
											console.log("a:"+a);
											if(this.data[i+1]=='不分组'){
												this.data.splice(i,3);											
											}else{
												this.data.splice(i,2);											
											}										
										}
										i++;
									});										
								}
							}
							console.log("newdata:"+this.data);																						
						},
						//判断是否匹配，采用方案为直接判断当前搜索框结果列表是否存在相同的值
						isMatch(){
							//1.当前的搜索框结果列表没有数据时，则判定为不存在匹配值，返回false
							//2.当前的搜索框结果列表有数据时,厉遍搜索框结果列表数据，如果不存在匹配值则返回false，否则返回true
							//3.当前的搜索框结果列表有数据时且搜索框结果列表数据有且只有只有一条数据，则直接返回true
							
							console.log("触发方法isMatch搜索框的值是否匹配"); 
							console.log("当前的搜索框结果列表数据长度:"+this.restaurants.length);	
							var i=0;
							var obj=false;
							if(this.restaurants.length==0){
								return false;
							}else if(this.restaurants.length==1){
								return true;
							}else{
								this.restaurants.find((a)=>{
									if(this.restaurants[i].value==this.state1){
										obj=true;
									}																				
									i++;
								});
								
								if(obj){
									return true;
								}
								return false;
							}
							
						},						
						//1.当字段不变时，替换原来的字段数据
						//2.当字段不变时,判断搜索框的值是否存在变化,没有变化则index索引值返回0,否则返回index
						//3.当字段不变时且输入宽的值和copy都为初始值时，放回flag=true
						checkData(){
							console.log("触发方法checkData搜索框字段不变时，替换原来的字段数据");
							console.log("olddata:"+this.data);
							console.log("select:"+this.select);
							console.log("输入框当前值:"+this.state1);
							var del=null;
							var i=0;
							var index=0;
							var obj={flag:true,index:index};
							
							if(this.state1Copy!=this.state1||this.state1Copy==''){
								if(this.select=='1'){
									del='机会主题';
								}else if(this.select=='2'){
									del='客户名称';
								}else{
									del='联系人';
								}
								console.log("del:"+del);
								this.data.find((a)=>{									
									if(a==del){
										console.log("a:"+a);	
										index=i+1;
									}
									i++;
								});
								if(index>0){
								obj={flag:false,index:index};
								}
								console.log("index:"+index);	
								console.log("data的长度:"+this.data.length);
								this.state1Copy==this.state1;
							
							}else{
								if(this.state1==''){
									obj={flag:true,index:0};	
								}else{
									obj={flag:false,index:0};
								}
								
								
							}
							
							return obj;	
						},
						//这里是视图的跳转方法，传入销售机会id
						saleView(salId){
							window.open("sales/saleView?salId="+salId);    						 		
						},
						loadInfo(id){
							 // `this` 在方法里指向当前 Vue 实例	

						//	alert(id);
									
								var _this = this;
			           			var form='';
		           				form=_this.form;
							 	
								/*
								* ------------------这个是修改的时候加载销售机会信息
								*/	 
								if(id!=0){
									 	axios.get("/sales/findOneSale",
							           			//参数转换
							           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
							           			//ajax请求成功的回调函数
							           			{
									 		params:{
									 			salId:id
									 		}
							           			}
							          			).then(function(response){					          				
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log(response.data);
							           			_this.initForm(response.data[0],_this,id);
							           			if(response.data[1]!=0||response.data[1]!=null){
								           			console.log(response.data[1]);
								           			console.log("长度："+response.data[1].length);
								           			for(var i=0;i<response.data[1].length;i++){
								           				var salLog=response.data[1][i];
								           				//console.log();
	 						           				if(salLog.sotlMoney==''){
								           					salLog.sotlMoney=0.00;
								           				} 
	 						           				if(salLog.notes==''){
	 						           						salLog.notes='';
	 						           				} 
	 						           				if(_this.salesOpportunityTrackingLogs==null){
	 						           				_this.salesOpportunityTrackingLogs='';
	 						           				}
								           				_this.salesOpportunityTrackingLogs=_this.salesOpportunityTrackingLogs+"日期:"+salLog.updateTime+"\t"+"阶段:"+salLog.SotlStage+"("+salLog.sotlPossibility+")"+"\t"+salLog.UName+"\t"+"预计:"+salLog.sotlDate+"(￥"+salLog.sotlMoney+")"+"\t"+"备注:"+salLog.notes+"\n";                             
								           			}							           				
							           			}

							           			//_this.salesOpportunityTrackingLogs=response.data[1].UName+;
							           	}).catch(function(){
							           		alert("加载单个销售机会信息出错了");
							           	});		 								
								}else{
									_this.initForm(" ",_this,id);
									
								}
						},
						/*
						加载表单时的初始化
						*/						
						initForm(json,_this,id){
		           			var form='';
	           				form=_this.form;

							/*
							custDemand:'',
							salPossibility:'',
							salSource:'',
							salStage:'',
							salStageNotes:'',
							salStageStop:'',
							salState:'1287',
							salTheme:'',
							salType:'',
							salUpdatetime:new Date(),
							sotlDate:new Date(),
							sotlMoney:'',
							starStandard:'1317',
							customer:'',
							salId:'',
							contact:''	
						  */
						  if(id!=0){
			           			form.salId=id+'';	
			           			form.starStandard=json.starStandard+'';
			           			form.salState=json.salState+'';	
			           			form.sotlDate=json.sotlDate+'';
			           		
						  }else{
							 	
							  form.salState='1287';
							  form.starStandard='1317';
							form.salId=null;
							form.salStage=null;						  
							form.sotlDate=new Date();
						  }
							/*if(json==" "&&form.salId!=null){

								this.$refs['form'].resetFields();								  
							}*/

		           			//console.log(json.customerName);
	           				form.customer=_this.toString(json.customerName);
	           				_this.gdID=_this.toString(json.customerId);	           			
	           				form.sotlId=_this.toString(json.sotlId);
		           			form.salStageNotes=_this.toString(json.salStageNotes);
		           			form.custDemand=_this.toString(json.custDemand);
		           			form.salTheme=_this.toString(json.salTheme);	 
		           			form.salStageStop=_this.toString(json.salStageStop);
		           			//salTage.push(json.salStagelabel+",value:'1324'");
		           			if(json.salStagelabel!=null){
			           			form.salStage=_this.toString(json.salStagelabel);
			           			//记录当前的销售阶段
			           			_this.salStageCopy=form.salStage;
		           			}else{
		           				var salTage={};
		           				salTage={label:["初期沟通"]};
		           				console.log(salTage.label);
		           				form.salStage=_this.toString(salTage.label);
		           			}

		           		//	_this.salStageValue=json.salStageValue+'';						           			
		           			/*if(json==" "){
		           				json=null;
		           			}*/

		           			form.salPossibility=_this.toString(json.salPossibilitylabel);
		           			//_this.salPossibilityValue=json.salPossibilityValue+'';
		           			
		           			form.salSource=_this.toString(json.salSourcelabel);
		           			form.sotlMoney=json.sotlMoney;
		           		//	_this.salSourceValue=json.salSourceValue+'';
		           			
		           			form.salType=_this.toString(json.salTypelabel);
		           		/*	if(json.salTypeValue!=null){
			           			_this.salTypeValue=json.salTypeValue+'';						           				
		           			}else{
		           				_this.salTypeValue="";
		           			}*/			           			
		           			//alert(json.customer);
	           				form.contact=_this.toString(json.contactName);
	           				_this.conID=_this.toString(json.contactId);	
	           				
				           				           		           			
						},
						//强制转换成String类型
						toString(val){
						return val==null?'':(val+'');
						},
						DeleteShow(salId){
							this.salId=salId;
							this.dialogDelete=true;
							
						},
						//删除方法
						Delete(){
							var _this=this;
						
							axios.get("/sales/Delete",
				           			//参数转换
				           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
				           			//ajax请求成功的回调函数
				           			{
										params:{
											salId:_this.salId
										}
				           			}
				          			).then(function(response){					          				
				           			console.log("回调成功，获取了服务器端返回的值v");
				           			console.log(response.data);

				           			//alert(_this.count);
					           			_this.$notify({
						           	          title: '删除成功',
						           	          type: 'success',
						           	       	  duration:3000
						           	        });
					           			/*
					           			-----------------------------刷新当前表单信息
					           			*/
					           			_this.page.AllpageNumber=_this.page.AllpageNumber-1;	
										console.log("当前页: "+_this.pageNumber);
										console.log("每页默认显示的条数:"+_this.pageCententSelect);
										_this.tableloading=true;
									 	axios.get("/sales/salePageable",
							           			{
							           		params: {
							          				pageNumber:_this.pageNumber,
							          				pageCentent:_this.pageCententSelect,
							          				DId:_this.DId
							          			    }
							           			}
							           			//ajax请求成功的回调函数
							          			).then(function(response){					          				
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log(response.data);
												_this.tableData3=response.data.saleOpp;
												_this.page.AllpageNumber=response.data.salesCount;
							     		 _this.tableloading=false;	
							           	}).catch(function(){
							           		alert("显示客户数据出错了");
							           	});	
									 	
				           			}).catch(function(){						           				
				           				alert("删除信息出错了");
				           			});
						},	
						//优化处理弹框事件
						deathWindow(formName){						
							if(this.dialogFormVisible==false){
								this.$refs[formName].clearValidate();	
								this.salesOpportunityTrackingLogs=null;
							}
						},
						//这个是新增以及修改 表单提交事件
					      submitForm(formName) {
							//alert(this.form.salStage);
										var i=" ";
							    	    var obj = {};
										var _this=this;
										//销售阶段
										if(_this.form.salStage!=null&&_this.form.salStage!=''){
								    	    obj = this.stages.find((a)=>{
									    	      return a.label ===_this.form.salStage; 
									    	    });
									    	   if(obj!=null){
										    	    _this.form.salStage=obj.value;
									    }
									    	   //谁新建谁负责，谁修改谁负责
											if(_this.form.salStage!=_this.salStageCopy){
												_this.form.sotlId=document.cookie;
											}
					           				console.log("机会负责人:"+_this.form.sotlId);
										}else{
											_this.form.salStage='';
										}

							    	    console.log("销售阶段:"+_this.form.salStage);
							    	    //可能性
								    	 console.log("可能性:"+_this.form.salPossibility);					    	    
							    	    if(_this.form.salPossibility!=null&&_this.form.salPossibility!=''){
									    	   obj = this.possibilities.find((a)=>{
										    	      return a.label ===_this.form.salPossibility; 
										    	    });	
									    	   if(obj!=null){
										    	    _this.form.salPossibility=obj.value;  
									    	   }
						    	    	
							    	    }else{
							    	    	_this.form.salPossibility='1293';
							    	    }
							    	    console.log("可能性:"+_this.form.salPossibility);	
							    	    //来源 
							    	    if(_this.form.salSource!=null&&_this.form.salSource!=''){
								    	    obj = this.salSources.find((a)=>{
									    	      return a.label ===_this.form.salSource; 
									    	    });	
									    	   if(obj!=null){
										    	    _this.form.salSource=obj.value;	
									    	   }
							    	    	
							    	    }else{
							    	    	_this.form.salSource=" ";
							    	    }
							    	    console.log("来源:"+ _this.form.salSource);	
							    	    //类型
							    	   // alert(_this.form.salType);
							    	    //alert(_this.form.state);
							    	    if(_this.form.salType!=null&&_this.form.salType!=''){
								    	    obj = this.salTypes.find((a)=>{
									    	      return a.label ===_this.form.salType; 
									    	    });		
									    	   if(obj!=null){
										    	    _this.form.salType=obj.value;
									    	   }
							    	    }else{
							    	    	_this.form.salType=" ";
							    	    }  
							    	    console.log("类型:"+_this.form.salType);

							    	    if(_this.form.salStageStop==null||_this.form.salStageStop==''){
							    	    	_this.form.salStageStop="0天";
							    	    }

							    	    var str=_this.form.salStageStop;
							    	    str=str.split("天");
							    	   // console.log("停留时间:"+str[0]);
							    	    this.form.salStageStop=str[0]+'';
										i=this.form.customer;
										this.form.customer=this.gdID;
										var form = this.form;
										
										i=this.form.contact;
										this.form.contact=this.conID;
										
										/* i=this.form.salPossibility;
										 this.form.salPossibility=this.salPossibilityValue;
										 
										 i=this.form.salSource;
										 this.form.salSource=this.salSourceValue;
										 
										 i=this.form.salStage;
										 this.form.salStage=this.salStageValue;
										// salType
										 i=this.form.salType;
										 this.form.salType=this.salTypeValue;	*/							 
										
										//alert(form.salType);
										 
					        this.$refs[formName].validate((valid) => {
					          if (valid) {
						            //alert('submit!');

				           			//console.log("log:"+Qs.stringify(this.form,{arrayat: 'brackets'}))		
				           			console.log(JSON.stringify(form));
								 	axios.get("/sales/Addsale",
						           			//参数转换
						           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})	
					           			{
					           		params:form 
					           			}


						           			//json.stringify(this.form)
						           			//ajax请求成功的回调函数
						          			).then(function(response){									    	  					          				
						          			_this.salesOpportunityTrackingLogs=null;					          			
						           			_this.$refs[formName].resetFields();//清空数据
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log(response.data);	
								           			_this.dialogFormVisible=false;
								           			if(_this.form.salId==null){
									           			_this.$notify({
										           	          title: '添加成功',
										           	          type: 'success',
										           	       	  duration:3000
										           	        });
									           			_this.page.AllpageNumber=_this.page.AllpageNumber+1;
								           			}else if(_this.form.salId!=null){
									           			_this.$notify({
										           	          title: '修改成功',
										           	          type: 'success',
										           	       	  duration:3000
										           	        });
								           			}else{
								           				
								           			}
						           			/*
						           			-----------------------------刷新当前表单信息
						           			*/						           								           			
											console.log("当前页: "+_this.pageNumber);
											console.log("每页默认显示的条数:"+_this.pageCententSelect);
											console.log("当id值: "+_this.form.salId);	
											
											if(_this.pageNumber==1||_this.form.salId!=null){
												_this.tableloading=true;
											 	axios.get("/sales/salePageable",
									           			{
									           		params: {
									          				pageNumber:_this.pageNumber,
									          				pageCentent:_this.pageCententSelect,
									          				DId:_this.DId
									          			    }
									           			}
									           			//ajax请求成功的回调函数
									          			).then(function(response){					          				
									           			console.log("回调成功，获取了服务器端返回的值v");
									           			console.log(response.data);
														_this.tableData3=response.data.saleOpp;
														_this.page.AllpageNumber=response.data.salesCount;
									     		 _this.tableloading=false;
									           	}).catch(function(){
									           		alert("显示客户数据出错了");
									           	});												
											}
	

						           		//this.tableData3=response.data;					           		
						           	//	this.AllpageNumber=this.count/response.data.length;
						     		//  _this.tableData3 = response.data;					     							           					           	
						           	}).catch(function(){
						           		_this.form.customer=i;
						           		alert("新增表单提交出错了");
						           	});				        	  
					          } else {
					            console.log('error submit!!');
					            return false;
					          }
					        });
					      },
					      //这个是表单重置方法
					     resetForm(formName) {
					        this.$refs[formName].resetFields();
					      },
					      //这个是表单的取消方法
					      cancelForm(formName){
					    	  this.salesOpportunityTrackingLogs=null;
					    	  this.dialogrepair = false;
					    	  this.dialogFormVisible = false;
					    	  this.$refs[formName].clearValidate();
					      },
							//这个是列表的选择事件
							 handleSelect(item) {
							    	  /*
							    	  [
							    		  contacts:{
												con: '选项1',
												conlabel: '联系人1'					
											},
											{
												con: '选项2',
												conlabel: '联系人2'					
											}]
							    	  */
							    	  var _this=this;	
								     //   console.log("当前的item的数值:"); 	
								      //  console.log(); 								        
							    	  if(item!=null){
									        console.log("value7Flag:"+this.value7Flag); 
							    		  if(this.value7Flag){							    			
								    		  _this.multipleSelection1(item);  
							    		  }
							    		  if(this.state1Session==true){
							    			  	  this.clearData();//清除搜索框的搜索条件
												 _this.searchSelect(item);	
												 //this.removeSearch=true;	
							    		  }
							    	  }else{
							    		
							    	  }	
									 	
							    	  //这里是处理选择对应客户之后，相应的赋值
							    	  if(item.conName!=null){
								    	  var contacts=[{con:item.label2,conlabel:item.conName}];
									        console.log("item:"+item.conName);
									        this.contacts=contacts;		
									        this.form.contact=item.conName;
						           			this.conID=item.label2;
							    	  }
								       if(item.label1!=null){
								        	  this.gdID=item.label1;
								        }
								      
								      },
								      //这里是处理多选条件的方法
								      multipleSelection1(item){
								    	  var _this=this;
								    	  console.log(item[item.length-1]);								    	  
								    		 var DId=item[item.length-1];
								    		  var i=0;
								    		  var count=new Array();
									    	  var obj=null,obj2=null;
					    					  var h=0,j=0;
											  console.log("value7:"+this.value7);
											  
											//  console.log("DId:"+DId);
											  //这里是所选值的循环
											  item.find((c)=>{
												  console.log("c:"+c);
												 // console.log("options3:"+_this.options3);
												  console.log("options3:"+_this.options3.length);
												  
												  //下面是的循环代码是判断在同一个父类字典信息中是否存在多个选中的值
												  
												  //这里是option3列表循环
												  _this.options3.find((b)=>{ 
													  console.log("options3:"+i);
													  //这里是options所有值的循环
											    	   _this.options3[i].options.find((a)=>{	
										    		   
											    		  console.log("测试："+c);
											    			 if(a.value===c){
														    	   console.log("当前所在的options："+i);	
											    				// count++;//同一个options选中的值数
											    				 console.log("这个options存在于所选值相等的值");
											    				if(obj2==null){
											    					console.log("当前所在父类："+_this.options3[i].label);
												    				 obj2={value:i,count:1,OldDId:a.value,parent:_this.options3[i].label,newDId:''};
												    				 count.push(obj2);
												    				 console.log("初始化看看是什么：value="+count[0].value+"\tcount="+count[0].count+"\tDId="+count[0].DId);
											    				}else{
											    					
											    					/*if(obj2.value==i){
											    						//obj2.count=2;
																		//当同一个options的值重复时，修改对应count数组的值即+1	
																		
											    						count.find((j)=>{
											    							if(j.value==i){
											    								j.count=2;
											    								j.newDId=a.value;
											    								console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count+"\tDId="+count[h].OldDId);
											    							}
											    							h++;
											    						});
											    						h=0;
											    					}else{
											    						//但不是一个同个options的值时，记录该值
												    				 obj2={value:i,count:1,OldDId:a.value,newDId:''};
													    				 count.push(obj2);
													    				 console.log("看看是什么：value="+obj2.value+"\tcount="+obj2.count+"\tDId="+obj2.OldDId);
											    					}*/
										    					var flag=count.find((j)=>{
										    						//当同一个options的值重复时，修改对应count数组的值即+1	
										    							if(j.value==i){
										    								j.count=2;
										    								j.newDId=a.value;
										    								console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count+"\tDId="+count[h].DId);
										    								return 1;
										    							}
										    							h++;
										    						});
										    						h=0;
										    						 if(flag!=null){
										    							 
										    						 }else{
													    				 obj2={value:i,count:1,OldDId:a.value,parent:_this.options3[i].label,newDId:''};
													    				 count.push(obj2);
													    				 console.log("看看是什么：value="+obj2.value+"\tcount="+obj2.count+"\tDId="+obj2.DId);
										    						 }
											    				}



																//if(count==2){
												    				/* if(_this.obj2!=null){
													    				 console.log("这个 _this.obj2的值不为空,进入所选值循环:"+_this.obj2);												    					 
														    			 var j=0;												    			
														    			 _this.value7.find((b)=>{
																	    		 //console.log("obj:"+obj); 													    		 
														    				  if(b==_this.obj2){
														    					  console.log("obj2:"+_this.obj2); 										    					  
														    					  console.log("所选值在改变之前的value7:"+ _this.value7); 
														    					  //_this.value7[j]=DId;
														    					 // _this.value7.pop();
														    					 _this.value7.shift();
														    					 // _this.value7[j]=null;
														    					  console.log("所选值在改变之后的value7:"+ _this.value7); 
														    					  //_this.obj2.value=obj.value;
														    					  _this.obj2=_this.value7;												    					  
														    					  console.log("修改完value7值之后将最新所选值赋值给_this.obj2:"+_this.obj2); 												    					  
																				return null;
														    				  }//b==_this.obj2
														    				 // j++;
														    			  });*/
												    				// }
												    				 /*else{
												    					 _this.obj2=c;
													    				 console.log("这个 _this.obj2的值等于空所有要给他赋值:"+ _this.obj2);										    					 
												    					 return;
												    				 }*/																					
																//}//count==2
												    			/* else{
											    					 _this.obj2=c;
												    				 console.log("这个 _this.obj2的值等于空所有要给他赋值:"+ _this.obj2);										    					 
											    					 return;
											    				 }*/
						    				 
											    			 }//a.value===c	

											    			 
												    	    });
											    	  console.log("obj:"+obj); 
											    	// if(obj!=null){										    		 
											    		// console.log("obj1:"+obj.value); 
											    		 /*
											    		 //第二次循环，判断所选值所在的options是否等于第一次所选择所在的options
											    		 //如果相等则进入所选值数组循环
											    		 */
											    		/* if(_this.options3[i].options==_this.option){
											    			 var j=0;
											    			
											    			 _this.value7.find((b)=>{
														    		 console.log("obj:"+obj.value); 													    		 
											    				  if(b==_this.obj2.value){
											    					  console.log("obj2:"+_this.obj2.value); 										    					  
											    					  console.log("value7:"+ _this.value7[j]); 
											    					  //_this.value7[j]=DId;
											    					  //_this.value7.pop();
											    					 // _this.value7[j]=null;
											    					  console.log("value7:"+ _this.value7); 
											    					  //_this.obj2.value=obj.value;
											    				  }
											    				  j++;
											    			  });	
										    				  _this.obj2.value=DId;
									    					  console.log(" _this.obj2.value:"+_this.obj2.value); 
											    			
											    		 }else{
													    	// _this.option=_this.options3[i].options;//记录用户所选值所在的options	
														    	_this.obj2=obj;  //这里记录选值的数值
													    		 console.log("options:"+_this.options); 
													    		 console.log("obj2:"+ _this.obj2.value);										    			 
											    		 }
											    	 }*/ 
													  i++;  //这里是options的自增索引值
												  });	
												  console.log("当前所选值结束列表循环-------------------------------------");
												  i=0;//将i重新赋值为0
											  });
											  this.removeSearch=true;
											  //这里我们厉遍我们记录的count数组
					    						count.find((it)=>{
												    console.log("count的当前循环次数:"+h);
												    if(it==null){
												    	return 0;
												    }
					    							//当选择的是全部数据时					    							
					    							if(it.OldDId==''){			    								
													     console.log("选择的是全部数据:"+_this.value7.length);	
						    								if(_this.value7.length>1){
															    console.log("count:"+count.length);
						    									count.splice(0,count.length-1);	
															    console.log("count:"+count.length);	
															    
						    								}else{					    									
															     console.log("第一次选择非全部数据删除全部数据:");						    									
							    								 count.splice(h,1);				    									
						    								}
					    								_this.value7.splice(0,_this.value7.length-1);
					    								return 0;

					    							}
					    							
					    							//当同一个的options出现重复值时
					    							if(it.count==2){
										    			 _this.value7.find((b)=>{
												    		// console.log("obj:"+obj.value); 													    		 
									    				  if(b==it.OldDId){
									    					  console.log("odddddd:"+j.DId);								    					  
									    					 // console.log("obj2:"+_this.obj2.value); 										    					  
														     console.log("所选值在改变之前的value7:"+ _this.value7); 
									    					  //_this.value7[j]=DId;
									    					  //_this.value7.pop();
									    					 // _this.value7[j]=null;
									    					 //arrayObj.splice(deletePos,deleteCount); //删除从指定位置deletePos开始的指定数量deleteCount的元素，数组形式返回所移除的元素
									    					_this.value7.splice(j,1);
								    					 	 //count.splice(j,1);
									    					  console.log("所选值在改变之后的value7:"+ _this.value7); 
									    					  //_this.obj2.value=obj.value;
									    				  }
								    						
									    				  j++;
									    			  });
										    			 j=0;
					    								//console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count);
					    							}
					    							h++;
							    							
					    						});
					    						this.option=count;
					
								      },
								      //搜索框，判断是否要进行分组查询
								      isGroup(flag){
								    	  var del=null;
								    	  var i=0;
								    	  var index=0;
								    	  var obj=true;
										    console.log("触发isGroup方法判断是否进行分组查询:"+flag);								    	  
										    console.log("Olddata:"+this.data);
											if(this.selectCopy=='1'){
												del='机会主题';
											}else if(this.selectCopy=='2'){
												del='客户名称';
											}else{
												del='联系人';
											}
											this.data.find((a)=>{									
												if(a==del){
													console.log("a:"+a);
													index=i;
								           			if(this.data[i+1]=='不分组'&&flag){
														flag=false;
														index=0;
								           			}
												}
												i++;
											});

								    	  if(flag){
								    		  if(index>0){
													index=index+1;
													this.data.splice(index,0,'不分组');									    			  
								    		  }
											
								    	  }else{
								    		  index=index+1;	
								    		  if(this.data[index]=='不分组'){	
								    			console.log("ffffffff:");							    			  
												this.data.splice(index,1);								    			  									    								    			  
								    		  }

									    		  
								    	  }
										   console.log("newdata:"+this.data);
								      },							      
								      //这里是处理搜索框查询字段选择的方法
								      searchSelect(item){
								    	  console.log("item:"+item.value); 
												var _this = this;											    	
									    		_this.matchFlag=true;												
												var data=null;
												this.tableloading=true;
												//this.clearData();//剔除搜索宽里的分页条件
												//this.data.push('');
												var obj=this.checkData();
												if(obj.index>0){
													if(item.value!=null){
									           			if(this.data[obj.index]=='不分组'){
															this.data[obj.index+1]=item.value;									           				
									           			}else{
															this.data[obj.index]=item.value;	
									           			}														
													}

												
												}
												this.checkData();//这
												 this.isGroup(true);
												data=''+this.data;
							           			console.log("data:"+data);												
												  //post提交数据
									           	axios.get("/sales/salePageable",
									           			{
									           		params: {
									          				pageNumber:1,
									          				pageCentent:4,
									          				DId:data
									          			    }
									           			}
									           			//ajax请求成功的回调函数
									          			).then(function(response){					          				
									           			console.log("回调成功，获取了服务器端返回的值v");
									           			console.log(response.data);
									           		//this.tableData3=response.data;
													_this.tableData3=response.data.saleOpp;
													_this.page.AllpageNumber=response.data.salesCount;
									     		 _this.tableloading=false;	
									           	}).catch(function(){
									           		alert("分页数据出错了");
									           	});												    		
								    	  
								    	  
					    	  
								      },
								      //这里是数据筛选下来宽事件
								  visibleChange(){
								    	  this.value7Flag=!this.value7Flag;
								    	  if(this.flag){
								    		  this.flag=false;
										 //copy值记录value的变化值
								    		  if(this.value7Copy==this.value7){
								    			  
								    		  }else{
									    		  this.screenQueries(); 								    			  
								    		  }
								    		  
								    	  }else{
								    		  this.flag=true;

								    	  }
								    	  
								      },    
								      //这里是数据筛选标签删除时的事件
								  removeTag(){
								    	  //console.log("item:"+item);	
								    	   console.log("触发removeTag数据筛选标签删除时的事件");
								    	  var _this=this;
								    	  var i=0;
								    	  console.log("value7的当前长度:"+_this.value7.length);
								    	  console.log("value7Copy的当前长度:"+_this.value7Copy.length);
								    	  console.log("value7:"+_this.value7);
								    	  console.log("value7Copy:"+_this.value7Copy);
								    	 var del=null;
								    	 //当value7为空时
								    	  if(_this.value7[0]==null){
								    		  //console.log("dd:"+_this.value7+"d");
								    		  console.log("条件搜索没有了呀，自动添加一个全部数据");
									    		_this.value7[0]='';	//表示添加一个全部数据									    		
										    	  console.log("olddata:"+_this.data.splice(1,1));	
									    		_this.data.push('');
									    		_this.removeSearch=false;
								    	  }
								    	 //查找被删除的值
								    		_this.value7Copy.find((a)=>{								    		  
								    		_this.value7.find((b)=>{ 
											   // console.log("被删除的值:"+b);								    			
								    			if(a!=b){
								    				del=a;

											    console.log("被删除的值del:"+del);	
								    			}
								    		
								    		}); 								    		 
								    	  });
								    	 
								    	  console.log("olddata:"+_this.data);								    	  
								    	  //删除data对等的数据
								    	  _this.data.find((c)=>{
								    		  if(del==c){
										    	  console.log("c:"+c);	
										    	  _this.data.splice(i-1,2);
								    		  }
								    		  i++;  

								    	  });								    	 								    	 
								    	  console.log("newdata:"+_this.data);
								    	  //同步copy值
								    	  _this.value7Copy=_this.value7;
								    	  console.log("新value7Copy:"+ _this.value7Copy);
								    	  var data=''+_this.data;
								    	  _this.tableloading=true;
									 	axios.get("/sales/salePageable",
							           			//参数转换
						           			//Qs.stringify({ids:_this.value7}, {arrayFormat: 'indices'})
						           			{
							           		params:{
						          				pageNumber:1,
						          				pageCentent:4,		
							           			DId:data
							           		}
							           												 		
						           			}

							           			//json.stringify(this.form)
							           			//ajax请求成功的回调函数
							          			).then(function(response){
									           			console.log("回调成功，获取了服务器端返回的值v");
									           			console.log(response.data);
									           			//console.log(response.data.salesCount);/
											_this.tableData3=response.data.saleOpp;
											_this.page.AllpageNumber=response.data.salesCount;
							           	//	this.AllpageNumber=this.count/response.data.length;
							     		//  _this.tableData3 = response.data;	
											  _this.tableloading=false;
											_this.value7Copy=_this.value7;//copy值记录value的变化值
							           	}).catch(function(){
							           		//_this.form.customer=i;
							           		alert("筛选查询出错了");
							           	});									    	  
	
								      },
								   	  //这里是筛选查询的方法,有点小问题
								   	 screenQueries(){
								    	  var _this=this;
								    	  var obj=null;
								    	  /*
								    	---------------------------------------数据筛选查询  
								    	 */
								    	 
								    	 console.log("option:"+_this.option);
											var data=new Array();
											var i=0;
											var index=0;
								    	  _this.option.find((a)=>{
									    	  console.log("option:"+a.OldDId+"\t"+a.parent);
									    	_this.data.find((b)=>{
												if(b===a.parent||a.parent=='全部数据'){
													index=i;
												}
												i++;
									    	  });

									    	 if(index>0){
										    	  console.log("index:"+index);
										    	  if(a.count==2){
											    	  console.log("parent"+a.parent);	
										    		  _this.data[i-1]=a.newDId;	
										    	  }else{
										    		  _this.data[i-1]=a.OldDId;								    		  
										    	  } 									    		 
									    	 }else{
										    	  if(a.count==2){
										    		  _this.data.push(a.parent);
										    		  _this.data.push(a.newDId);	
										    	  }else{
										    		  _this.data.push(a.parent);	
										    		  _this.data.push(a.OldDId);								    		  
										    	  }
									    	 }
 									    	  
									    	  });	
											this.clearData();//剔除搜索宽里的分页条件								    	  	  
									    	  data=''+_this.data;
									    	  console.log("data:"+data);	
									    	  _this.tableloading=true;
										 	axios.get("/sales/salePageable",
								           			//参数转换
							           			//Qs.stringify({ids:_this.value7}, {arrayFormat: 'indices'})
							           			{
								           		params:{
							          				pageNumber:1,
							          				pageCentent:4,		
								           			DId:data
								           		}
								           												 		
							           			}

								           			//json.stringify(this.form)
								           			//ajax请求成功的回调函数
								          			).then(function(response){
										           			console.log("回调成功，获取了服务器端返回的值v");
										           			console.log(response.data);
										           			//console.log(response.data.salesCount);/
												_this.tableData3=response.data.saleOpp;
												_this.page.AllpageNumber=response.data.salesCount;
								           	//	this.AllpageNumber=this.count/response.data.length;
								     		//  _this.tableData3 = response.data;	
												  _this.tableloading=false;
												_this.value7Copy=_this.value7;//copy值记录value的变化值
								           	}).catch(function(){
								           		//_this.form.customer=i;
								           		alert("筛选查询出错了");
								           	});	

								      },
								      //这里是解除搜索，显示全部数据的方法
								      removeSearch1(){
										//数据筛选下拉框，初始化为全部数据
										this.value7.splice(0,this.value7.length);										
										this.value7[0]='';
										this.value7Copy=this.value7;//copy值记录value的变化值
										this.option=[{count:1,OldDId:'',parent:'全部数据'}];
										//清除搜索条件，只保留“全部数据”这个条件
										this.data.splice(2,this.data.length);
										//调用数据筛选查询
										this.screenQueries();
										//将解除搜索按钮变为不可见
										this.removeSearch=false;
										//清除动态搜索框的输入数据
										this.state1=null;
								      },
								      //这里是加载外表，对应客户的方法
							     abroadsaleCustName() {
								   var _this=this;
								   //AllpageNumber			   
								 	axios.get("/sales/abroadsaleCustName",
							           			{
							           		params: {
							           			custName:_this.customer
							          			    }
							           			}
							           			//ajax请求成功的回调函数
							          			).then(function(response){					          				
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log("修改:"+response.data);					           		
							           		_this.restaurants=response.data;
							           	}).catch(function(){
							           		alert("加载外表,显示客户初始化数据出错了");
							           	});	//这个是数据的初始化
						          
								      },
								      //这里是加载内表，对应客户的方法
								      withinsaleCustName(){
								    	  var _this=this;
								    	  this.isGroup(false);
						           			console.log("Data:"+_this.data);
						           			var data=''+_this.data;
										 	axios.get("/sales/withinsaleCustName",
								           			{
								           		params: {
								           			DId:data
								          			    }
								           			}
								           			//ajax请求成功的回调函数
								          			).then(function(response){					          				
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log("修改:"+response.data);					           		
								           		_this.restaurants=response.data;
								           	
								           	}).catch(function(){
								           		alert("加载内表,显示客户初始化数据出错了");
								           	});	//这个是数据的初始化								    	  
								      },
								      //这里是加载销售机会主题的方法
								   withinSaleFindByTheme(){
								    	  var _this=this;
						           			console.log("Data:"+_this.data);
						           			var data=''+_this.data;
										 	axios.get("/sales/withinSaleFindByTheme",
								           			{
								           		params: {
								           			DId:data
								          			    }
								           			}
								           			//ajax请求成功的回调函数
								          			).then(function(response){					          				
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log("修改:"+response.data);					           		
								           		_this.restaurants=response.data;
								           		
								           	}).catch(function(){
								           		alert("加载销售机会主题数据出错了");
								           	});	//这个是数据的初始化								    	  
								      },
								      //这里是加载外表，负责人的方法
								      abroadsaleAddUnameInfo(){
											 /*
											------------------加载负责人信息
											 */	
											 var _this=this;
											 
											 	axios.get("/sales/abroadsaleAddUnameInfo",
									           			//参数转换
									           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
									           			//ajax请求成功的回调函数
									           			{
											 				params:{
											 					uName: _this.soltId
											 				}
									           			}
									          			).then(function(response){					          				
									           			console.log("回调成功，获取了服务器端返回的值v");
									           			console.log("user:"+response.data);
													/*
													users:[
													{
														value: '选项1',
														label: '用户名1'					
													}
													]
													*/
										           	//_this.users=response.data;
										          	_this.restaurants=response.data;
									           		
									           	}).catch(function(){
									           		alert("加载外表,负责人信息出错了");
									           	});	  
								      },
								      //这里是加载内表，联系人的方法
								      withinsaleAddUnameInfo(){
								    	  var _this=this;
								    	  this.isGroup(false);//查询分组
						           			console.log("Data:"+_this.data);
						           			var data=''+_this.data;											 
											 	axios.get("/sales/withinsaleAddUnameInfo",
									           			//参数转换
									           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
									           			//ajax请求成功的回调函数
									           			{
											 				params:{
											 					DId: data
											 				}
									           			}
									          			).then(function(response){					          				
									           			console.log("回调成功，获取了服务器端返回的值v");
									           			console.log("user:"+response.data);
													/*
													users:[
													{
														value: '选项1',
														label: '用户名1'					
													}
													]
													*/
										           	//_this.users=response.data;
										          	_this.restaurants=response.data;
									           	}).catch(function(){
									           		alert("加载内表,联系人信息出错了");
									           	});	 
								      },
										 //这个是显示查询的数据
										 querySearchAsync(queryString, cb) {

										        var restaurants = this.restaurants;				       
										        var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;	
										        
										      	console.log("results:"+results);//查看返回结果如果不为空则表示在当前列表中存在比配值，为空表示没有比配值									        
												        if(queryString==null||queryString.length==0){
										        		 
												        	 if(this.state1Flag){
												        		 //当不为空,触发解除搜索功能,且解除搜索没有触发
												        		 if(this.state1!=null&&this.removeSearch!=true){
													        		 this.removeSearch=true;										        			 
												        		 }	
												        		 var obj=this.checkData();
												        		 if(obj.flag){
																     if(this.select=='1'){	    															    	
																    	 this.data.push('机会主题');
																    	 this.data.push("%");
																    	 this.withinSaleFindByTheme();
																     }else if(this.select=='3'){
																    	 this.data.push('联系人');
																    	 this.data.push("%");
																    	 this.withinsaleAddUnameInfo();	 
																     }else{
																    	 console.log("this.data:"+this.data);															    	 
																    	 this.data.push('客户名称');
																    	 this.data.push("%");
																		 this.withinsaleCustName();										    		 
																     }													        			 
												        		 } 															    
														    	 															     
	 
												        	 }
															if(this.customerFlag){
														    	 this.customer=null;
														    	  this.abroadsaleCustName();
																		
															}
												        	if(this.soltIdFlag){
															     this.soltId=null;															    	 
														    	 this.abroadsaleAddUnameInfo(); 												        	 		
												        	 }

			       
													        clearTimeout(this.timeout);
													        this.timeout = setTimeout(() => {
													       	cb(this.restaurants);
													       }, 3000* Math.random());	
												        }else{
													      	if(results==''){
													    	  console.log("queryString3:"+queryString);	
													    	  if(this.state1Flag){
													        		 var obj=this.checkData();
													    		     if(obj.flag){
																	     if(this.select=='1'){
																	    	 this.data.push('机会主题');
																	    	 this.data.push(queryString);
																	    	 this.withinSaleFindByTheme();																    	 
																	     }else if(this.select=='3'){
																	    	 this.data.push('联系人');
																	    	 this.data.push(queryString);
																	    	 this.withinsaleAddUnameInfo();	 															    		 
																	     }else{																	    	 
																	    	 this.data.push('客户名称');
																	    	 this.data.push(queryString);
																			 this.withinsaleCustName();											    		 
																	     }														    		    	 
													    		     }else{
													    		    	 if(this.data[obj.index]=='不分组'){
																	    	 this.data[obj.index+1]=queryString;													    		    		 
													    		    	 }else{
																	    	 this.data[obj.index]=queryString;														    		    		 
													    		    	 }
																	     if(this.select=='1'){
																	    	 this.withinSaleFindByTheme();																    	 
																	     }else if(this.select=='3'){
																	    	 this.withinsaleAddUnameInfo();	 															    		 
																	     }else{																	    	 
																			 this.withinsaleCustName();											    		 
																	     }	 
													    		     }
													    		  
													    	  }
															if(this.customerFlag){
														    	 this.customer=queryString;
														    	  this.abroadsaleCustName();																		
															}
													        if(this.soltIdFlag){
															     this.soltId=queryString;;															    	 
														    	 this.abroadsaleAddUnameInfo(); 
												        	 		
													        }
															        clearTimeout(this.timeout);
															        this.timeout = setTimeout(() => {
															       ;
															       	cb(this.restaurants);
															       }, 3000* Math.random());		     

												        }else{
													        clearTimeout(this.timeout);
													        this.timeout = setTimeout(() => {												     
													       	cb(results);
													       }, 1000* Math.random());
													        
												        }
													    	  
												    }						
										      },
										    //这个是根据输入的内容筛选数据
										   createStateFilter(queryString) {
										        return (state) => {return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);};
										      },
										handleClick(row) {
											console.log(row);
										},
										handleSelectionChange(val) {
											//console.log("共:"+val);
											this.multipleSelection = val;
										},
										//这个是选择显示数据条数事件
										handleSizeChange(val) {
											var _this = this;
											this.tableloading=true;
											this.pageCententSelect=val;
											console.log("当前页: "+this.pageNumber);
											console.log("每页默认显示的条数:"+this.pageCententSelect);
											this.clearData();//剔除搜索宽里的分页条件
											var data=''+this.data;
										 	axios.get("/sales/salePageable",
								           			{
								           		params: {
								          				pageNumber:this.pageNumber,
								          				pageCentent:this.pageCententSelect,
								          				DId:data
								          			    }
								           			}
								           			//ajax请求成功的回调函数
								          			).then(function(response){					          				
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log(response.data);
								           		//this.tableData3=response.data;					           		
												_this.tableData3=response.data.saleOpp;
												_this.page.AllpageNumber=response.data.salesCount;
								     		 _this.tableloading=false;
								           	}).catch(function(){
								           		alert("显示客户数据出错了");
								           	});
										},
										//这个是翻页事件
										handleCurrentChange(val) {
											var _this = this;
											this.pageNumber=val;
											this.tableloading=true;
											console.log("当前的分页条件: "+this.data);											
											console.log("当前页: "+val);
											console.log("每页默认显示的条数:"+this.pageCententSelect);
											this.clearData();//剔除搜索宽里的分页条件
											var data=''+this.data;
											  //post提交数据
								           	axios.get("/sales/salePageable",
								           			{
								           		params: {
								          				pageNumber:this.pageNumber,
								          				pageCentent:this.pageCententSelect,
								          				DId:data
								          			    }
								           			}
								           			//ajax请求成功的回调函数
								          			).then(function(response){					          				
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log(response.data);
								           		//this.tableData3=response.data;
												_this.tableData3=response.data.saleOpp;
												_this.page.AllpageNumber=response.data.salesCount;
								     		 _this.tableloading=false;	
								           	}).catch(function(){
								           		alert("分页数据出错了");
								           	});
										},
									      handleClose(done) {
									        this.$confirm('是否保存？')
									          .then(_ => {
									            done();
									          })
									          .catch(_ => {});
									      },
									      //这里是保存数据显示的方法
									      saveshowInfo(){
									    	   var _this=this;
									    	   var arr=new Array();
									    	   arr=document.cookie;
									    	  var saveInfo=new Array();
									    	  saveInfo.push("soltId:"+(_this.showSoltId?1:0));
									    	  saveInfo.push("Conid:"+(_this.showConid?1:0));
									    	  saveInfo.push("Cstdemand:"+(_this.showCstdemand?1:0));
									    	  saveInfo.push( "SalType:"+(_this.showSalType?1:0));
									    	  saveInfo.push("Salfile:"+(_this.showSalfile?1:0));
									    	  saveInfo.push("Salpossibility:"+(_this.showSalpossibility?1:0));
									    	  saveInfo.push("Salsource:"+(_this.showSalsource?1:0));
									    	  saveInfo.push("Salstage:"+(_this.showSalstage?1:0));
									    	  saveInfo.push("Salstagenotes:"+(_this.showSalstagenotes?1:0));
									    	  saveInfo.push("Salstagestop:"+(_this.showSalstagestop?1:0));
									    	  saveInfo.push("Salstate:"+(_this.showSalstate?1:0));
									    	  saveInfo.push("Salupdatetime:"+(_this.showSalupdatetime?1:0));
									    	  saveInfo.push("StarStandard:"+(_this.showStarStandard?1:0));
									    	  saveInfo.push("sotlMoney:"+(_this.showSotlMoney?1:0)); 
									    	  saveInfo.push("SotlDate:"+(_this.showSotlDate?1:0));
									    	  saveInfo.push("userid:"+ arr);
									    	  saveInfo.push("setId:"+_this.setId);
									    	  
									    	  console.log(saveInfo);
									    		axios.get("/sales/updateInfo",
									           			{
											 		params:{
											 			Info:(""+saveInfo)									 			
											 		}
											 			}
									          			).then(function(response){					          				
									           			console.log("回调成功，获取了服务器端返回的值v");
									           			console.log(response.data);
															
													
									           	}).catch(function(){
									           		alert("加载显示字段值失败");
									           	});	 	
									    		_this.showInfo=false;
									      } ,
									      print(obj){
									    	/*------------------------------------------*/
									    	//1.让新页面包含之前页面的引用
									    	//2.去掉多余的元素表格
													 var _this=this;
														 this.printFlag1=true;
 													 setTimeout(function(){
															// newWindow.print();
															//window.print();	 
														 _this.printFlag2=true;
														 }, 300); 
													 setTimeout(function(){
															// newWindow.print();
															//window.print();
															
													 var newWindow=window.open("销售机会列表","_blank");
													 var docStr = document.getElementById("print").innerHTML;
 													 newWindow.document.write(docStr);
													 var styles=document.createElement("script");
													 var link=document.createElement("link");
													 var script=document.createElement("script");
													 script.setAttribute('src','https://unpkg.com/element-ui/lib/index.js');
													 
													  styles.setAttribute('src','https://unpkg.com/vue/dist/vue.js');// media="print"
													  
													  
													 link.setAttribute('rel','stylesheet');
													 link.setAttribute('href','https://unpkg.com/element-ui/lib/theme-chalk/index.css');//.appendChild(link).appendChild(script)
													 
													  var styleContent=document.createElement("style");
													  styleContent.setAttribute('type',"text/css");
													  //width:1010px;height:369px;
															styleContent.innerHTML="body{margin:0 auto;width:1080px;background:pink;}"			 		
													 	//页面打印缩放比例设置
													   //  document.getElementsByTagName('body')[0].style.zoom=0.92;
													 	
													 newWindow.document.getElementsByTagName('head')[0].appendChild(styles);	
													 newWindow.document.getElementsByTagName('head')[0].appendChild(script);
													 newWindow.document.getElementsByTagName('head')[0].appendChild(link);	
						
													 newWindow.document.getElementsByTagName('head')[0].appendChild(styleContent);	
													 //由于采用了引用，需要时间通过网络来获取样式加载，所以要给它加载的时间
													 //不能采用sleep的方式，会导致浏览器资源被占用，无法加载通过网络获取的颜色		
													 	 _this.printFlag1=false;
	 													 setTimeout(function(){	 
															 _this.printFlag2=false;
															 }, 200); 
													 setTimeout(function(){

														 newWindow.print();
														 newWindow.close(); 
														//window.print();	 
													 }, 1000);																								
														 //_this.printFlag2=true;
														 }, 2000);
													
		
									      },
									      
									      //
									      sleep(n){
									    	  var start = new Date().getTime();
									          //  console.log('休眠前：' + start);
									          while (true) {
									              if (new Date().getTime() - start > n) {
									                  break;
									              }
									            }
									      },
									      //表格列样式设置
									       //表格行样式设置	
									      cellStyle({row,rowIndex,column,columnIndex}){
									    	  //column是个对象
									      
									    	  //console.log(columnIndex);
									      
									    	  if(rowIndex==this.pageCententSelect-1){
									    		  return 'border:1px solid #ebeef5;'
									    	  } 									    	  
									    	  
									    	  if(columnIndex==0){
									    		  return 'border-left:1px solid #ebeef5;border-right:1px solid #ebeef5;border-top:1px solid #ebeef5'
									    	  }
									      
									    	  return 'border-right:1px solid #ebeef5;border-top:1px solid #ebeef5;border-left:1px solid #ebeef5'
									      
									    	  },
									      
					},
							    //这里是页面初始化时加载数据的事件
								    mounted() {	
									this.data.push('全部数据');
									this.data.push('');
									//这里是加载主题名称信息
							    	this.withinSaleFindByTheme();
									//加载负责人信息
									//this.loadUsers();
									//数据筛选下拉框，初始化为全部数据
									this.value7[0]='';
									this.value7Copy=this.value7;//copy值记录value的初始化值,数据筛选下拉框
									this.valueCopy=this.state1;//copy值记录value的初始化值,搜索框
							    	/*
							    	*
							    	数据筛选下拉框加载数据,加载字典信息
							    	*/					
										var _this = this;
					           			var form='';
				           				form=_this.form;
									 	axios.post("/sales/saleAddDictionaryInfo",
							           			//参数转换id
							           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
							           			//ajax请求成功的回调函数
							          			).then(function(response){					          				
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log(response.data);
							     		 //source 来源
							     		 //possibilities 可能性
							     		 //stages 销售阶段
							           		_this.possibilities=response.data[0];
								           	_this.salSources=response.data[1];	
								           	_this.stages=response.data[2];	
								           	_this.salTypes=response.data[3];
								           	// 来源
									    	_this.options3[1].options=response.data[1];
								           	//可能性
									    	_this.options3[2].options=response.data[0];
								           	//销售阶段
									    	_this.options3[3].options=response.data[2];
								           	
							           	}).catch(function(){
							           		alert("加载字典信息出错了");
							           	});	
									//获取当前登录用户的编号
									var arr=new Array();
									var Id='';
										arr=document.cookie;
										console.log("当前用户的cookie:"+arr);
									/*	for(var i=0;i<arr.length;i++){
											if(arr[i]==";"){
												Id=arr.slice(i,arr.length)
											}
										}*/
										this.form.sotlId=arr;	
										console.log(this.form.sotlId);
									 	axios.get("/sales/showInfo",
							           			{
									 		params:{
										 		userId:arr									 			
									 		}
									 			}
							          			).then(function(response){					          				
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log(response.data);
				 								/*showSoltId:true,//这里设置字段是否显示
												showSalType:true,//类型
												showSotlDate:true;//预计签单日期
												showStarStandard:true;//星标
												showSotlMoney:true;//预期金额
												showSal_updatetime:true;//销售机会的更新时间
												showCon_id:true,//联系人名称
												showSal_state:true,// 销售状态
												showCst_demand :true,//客户需求
												showSal_possibility:true,//可能性
												showSal_source:true,//来源
												showSotl_name:true,//机会负责人名
												showSal_stage:true,//销售阶段
												showSal_stage_notes:true,//阶段备注
												showSal_stage_stop:true,//阶段停留
												showSal_file:true,//上传附件*/	
												_this.setId=response.data.setId;
												_this.showSoltId=0==response.data.showSoltId?false:true;
	 						           			_this.showConid=0==response.data.showCon_id?false:true;
							           			_this.showCstdemand=0==response.data.showCst_demand?false:true;
												_this.showSalType=0==response.data.showSalType?false:true;
												_this.showSalfile=0==response.data.showSal_file?false:true;
												_this.showSalpossibility=0==response.data.showSal_possibility?false:true;
												_this.showSalsource=0==response.data.showSal_source?false:true;
												_this.showSalstage=0==response.data.showSal_stage?false:true;
												_this.showSalstagenotes=0==response.data.showSal_stage_notes?false:true;
												_this.showSalstagestop=0==response.data.showSal_stage_stop?false:true;
												_this.showSalstate=0==response.data.showSal_state?false:true;
												_this.showSalupdatetime=0==response.data.showSal_updatetime?false:true;
												_this.showSotlname=0==response.data.showSotl_name?false:true;
												_this.showSotlDate=0==response.data.showSotlDate?false:true;
												_this.showStarStandard=0==response.data.showStarStandard?false:true;
												_this.showSotlMoney=0==response.data.showSotlMoney?false:true;
							           	}).catch(function(){
							           		alert("加载显示字段值失败");
							           	});	
								},

								
								
					}
					var Ctor = Vue.extend(Main1)
					//bigbox
					new Ctor().$mount('#bigbox')
/*---------------------------------------------------------------------------------------------------------------------*/							   
							   
		</script>
</html>
